package jiangyeheng.third;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Main {
    public static void main(String[] args) {
        String[] color = {"草花", "方片", "红桃", "黑桃"};
        String[] number = {"K", "Q", "J", "10", "9", "8", "7", "6", "5", "4", "3", "2", "A"};
        List<String> deck = new ArrayList<>();
        for (String c : color) {
            for (String n : number) {
                deck.add(c + n);
            }
        }
        deck.add("大王");
        deck.add("小王");
        Collections.shuffle(deck);

        int playerCount = 4;
        List<List<String>> players = new ArrayList<>();
        for (int i = 0; i < playerCount; i++) {
            players.add(new ArrayList<>());
        }

        int cardIndex = 0;
        for (String card : deck) {
            players.get(cardIndex % playerCount).add(card);
            cardIndex++;
        }
        for (int i = 0; i < players.size(); i++) {
            System.out.println("玩家" + (i + 1) + "的牌：" + players.get(i));
            System.out.println("牌数：" + players.get(i).size() + "张");
            System.out.println();
        }

    }
}